Electronic device and method of training classification model for age-related macular degeneration

ABSTRACT

An electronic device and a method of training a classification model for age-related macular degeneration (AMD) are provided. The method includes the following steps. Training data is obtained. A loss function vector corresponding to the training data is calculated based on a machine learning algorithm, in which the loss function vector includes a first loss function value corresponding to a first classification of AMD and a second loss function value corresponding to a second classification of AMD, the first classification corresponds to a first group, and the second classification corresponds to one of the first group and a second group. The first loss function value is updated according to the second loss function value and a group penalty weight in response to the second classification corresponding to the second group to generate an updated loss function vector. The classification model is trained according to the updated loss function vector.

CROSS-REFERENCE TO RELATED APPLICATION

This application claims the priority benefit of Taiwan application serial no. 110120194, filed on Jun. 3, 2021. The entirety of the above-mentioned patent application is hereby incorporated by reference herein and made a part of this specification.

BACKGROUND Technical Field

This disclosure relates to an electronic device and a method of training a classification model for age-related macular degeneration.

Description of Related Art

Age-related macular degeneration (AMD) includes four classifications according to the severity of clinical symptoms. The four classifications are respectively, a first stage, a second stage, a third stage, and a fourth stage. Currently, some personnel use an artificial intelligence (AI) model to analyze fundus images so as to classify the severity of the age-related macular degeneration. The personnel may use training data annotated by medical personnel to train the artificial intelligence model. In general, the medical personnel classify the age-related macular degeneration according to the macular area in the fundus image. However, different medical personnel may have different identifications of the macular area. Therefore, the artificial intelligence model trained by the training data annotated by different medical personnel may have an issue of overfitting, thereby reducing the classification accuracy of the artificial intelligence model.

On the other hand, medical personnel have different treatments for the different stages of the age-related macular degeneration. The third stage and the fourth stage are the more severe stages. When a patient has clinical symptoms of the third stage or the fourth stage, the medical personnel has to arrange a referral for the patient immediately, so as to further confirm the condition of the patient. In contrast, when a patient has clinical symptoms of the first stage or the second stage, the urgency of arranging a referral for the patient is low. Therefore, when the classification model incorrectly classifies the third stage (or the fourth stage) of the age-related macular degeneration as the first stage (or the second stage), it may cause delay in treating the patient optimally.

SUMMARY

This disclosure provides an electronic device and a method of training a classification model for age-related macular degeneration, which may train to obtain a classification model for the age-related macular degeneration with high accuracy.

An electronic device for training a classification model for age-related macular degeneration according to the disclosure includes a processor and a transceiver. The processor is coupled to the receiver. The processor is configured to execute the following steps. Training data is obtained through the transceiver. A loss function vector corresponding to the training data is calculated based on a machine learning algorithm, in which the loss function vector includes a first loss function value corresponding to a first classification of the age-related macular degeneration and a second loss function value corresponding to a second classification of the age-related macular degeneration. The first classification corresponds to a first group, and the second classification corresponds to one of the first group and a second group. The first loss function value is updated according to the second loss function value and a group penalty weight in response to the second classification corresponding to the second group, so as to generate an updated loss function vector. Then, the classification model is trained according to the updated loss function vector.

In an embodiment of the disclosure, the processor is further configured to execute the following step. The first loss function value is updated according to the second loss function value in response to the second classification corresponding to the first group, so as to generate the updated loss function vector.

In an embodiment of the disclosure, the first classification and the second classification respectively correspond to different stages of the age-related macular degeneration. The processor is further configured to execute the following steps. A first penalty weight is generated according to a stage difference between the first classification and the second classification. Then, the first loss function value is updated according to the second loss function value and the first penalty weight, so as to generate the updated loss function vector.

In an embodiment of the disclosure, the loss function vector further includes a third loss function value corresponding to a third classification of the age-related macular degeneration, the processor is further configured to execute the following steps. A second penalty weight is generated according to a second stage difference between the first classification and the third classification. Then, the first loss function value is updated according to the third loss function value and the second penalty weight, so as to generate the updated loss function vector.

In an embodiment of the disclosure, the third classification corresponds to one of the first group and the second group. The processor is further configured to execute the following steps. The first loss function value is updated according to the third loss function value and the second penalty weight in response to the third classification corresponding to the first group, so as to generate the updated loss function vector. In addition, the first loss function value is updated according to the third loss function value, the second penalty weight, and the group penalty weight in response to the third classification corresponding to the second group, so as to generate the updated loss function vector.

In an embodiment of the disclosure, the second stage difference is greater than the stage difference, and the second penalty weight is greater than the first penalty weight.

In an embodiment of the disclosure, the first penalty weight is proportional to the stage difference.

In an embodiment of the disclosure, the training data further includes a fundus image annotated with an age-related macular degeneration stage. The loss function vector corresponds to a binary cross-entropy function.

In an embodiment of the disclosure, the processor calculates the second loss function value and a quotient of the group penalty weight, so as to generate the updated loss function vector.

The method of training the classification model for age-related macular degeneration according to the disclosure includes the following steps. Training data is obtained. A loss function vector corresponding to the training data is calculated based on a machine learning algorithm, in which the loss function vector includes a first loss function value corresponding to a first classification of the age-related macular degeneration and a second loss function value corresponding to a second classification of the age-related macular degeneration. The first classification corresponds to a first group and the second classification corresponds to one of the first group and a second group. The first loss function value is updated according to the second loss function value and a group penalty weight in response to the second classification corresponding to the second group, so as to generate an updated loss function vector. Then, the classification model is trained according to the updated loss function vector.

Based on the above, the electronic device of the disclosure may use the classification weight to update the loss function value of the machine learning algorithm, and train the classification model according to the updated loss function value. The classification model of the disclosure is less likely to misjudge the third stage (or the fourth stage) of the age-related macular degeneration with more severe symptoms as the first stage (or the second stage) with relatively mild symptoms. The medical personnel may determine timely whether it is necessary to arrange a referral for a patient according to the classification results.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic diagram of an electronic device for training a classification model for age-related macular degeneration according to an embodiment of the disclosure.

FIG. 2 is a schematic diagram of updating a loss function vector according to an embodiment of the disclosure.

FIG. 3 is a flowchart of a method of training a classification model for age-related macular degeneration according to an embodiment of the disclosure.

DESCRIPTION OF THE EMBODIMENTS

To make the aforementioned more comprehensible, several embodiments accompanied with drawings are described in detail as follows. The following embodiments are specifically cited as examples which the present invention may be implemented. In addition, wherever possible, elements/components/steps with the same reference numerals in the drawings and the embodiments represent the same or similar components.

A classification model for classifying age-related macular degeneration may be generated based on training data (for example, fundus images with annotations of the age-related macular degeneration stages) annotated by medical personnel. However, the training data with annotations determined by the medical personnel may not necessarily be correct. For example, the medical personnel may classify a first stage of the age-related macular degeneration as a second stage of the age-related macular degeneration. When the classification model is too focused on classifying these easily confused data, the classification model may lose its generalization capability due to overfitting. On the other hand, the first stage and the second stage of the age-related macular degeneration are stages that do not require a referral, while a third stage and a fourth stage of the age-related macular degeneration are stages that require a referral. Therefore, when the classification model misjudges a third stage (or a fourth stage) as the first stage (or second stage), the referral of a patient may be delayed, thereby missing an optimal timing to treat the patient. Based on the above, the disclosure proposes a method of training a classification model for the age-related macular degeneration, which may avoid training to obtain an overfitting classification model. In addition, the classification model of the disclosure is less likely to misjudge the stages corresponding to a first group (for example, a group of the stages that do not require a referral) as corresponding to a second group (for example, a group of the stages that require a referral).

FIG. 1 is a schematic diagram of an electronic device 100 for training a classification model for age-related macular degeneration according to an embodiment of the disclosure. The electronic device 100 may include a processor 110, a storage medium 120, and a transceiver 130. The classification model may be configured to generate a classification of the age-related macular degeneration according to data that is inputted. The classification may include the first stage, the second stage, the third stage, or the fourth stage of the age-related macular degeneration.

The processor 110 is, for example, a central processing unit (CPU), or other programmable general-purpose or special-purpose micro control unit (MCU), a microprocessor, a digital signal processor (DSP), a programmable controller, an application-specific integrated circuit (ASIC), a graphics processing unit (GPU), an image signal processor (ISP), an image processing unit (IPU), an arithmetic logic unit (ALU), a complex programmable logic device (CPLD), a field programmable gate array (FPGA), or other similar elements, or a combination of the above elements. The processor 110 may be coupled to the storage medium 120 and the transceiver 130, and access and execute multiple modules and various application programs stored in the storage medium 120, so as to execute functions of the electronic device 100.

The storage medium 120 is, for example, any type of fixed or removable random access memory (RAM), a read-only memory (ROM), a flash memory, a hard disk drive (HDD), a solid state drive (SSD), or similar elements, or a combination of the above elements, and is configured to store the multiple modules or the various application programs that may be executed by the processor 110.

The transceiver 130 transmits and receives a signal in a wireless or wired manner. The transceiver 130 may also execute operations such as low noise amplification, impedance matching, frequency mixing, up or down frequency conversion, filtering, amplification, and other similar operations.

The processor 110 may obtain a training data set for training the classification model through the transceiver 130. The training data set may include multiple training data. The training data is, for example, a fundus image annotated with an age-related macular degeneration stage.

FIG. 2 is a schematic diagram of updating a loss function vector 23 according to an embodiment of the disclosure. The classification model is, for example, a machine learning model. The processor 110 may calculate the loss function vector 23 corresponding to the training data based on a machine learning algorithm. Since the age-related macular degeneration includes the first stage, the second stage, the third stage, and the fourth stage, the loss function vector 23 may include four loss function values respectively corresponding to the first stage, the second stage, the third stage, and the fourth stage. However, the disclosure is not limited thereto. For example, the loss function vector 23 may contain any number of loss function values. In the embodiment, the loss function vector 23 may be expressed as [e(1) e(2) e(3) e(4)], where e(1) is a loss function value corresponding to the first stage, e(2) is a loss function value corresponding to the second stage, e(3) is a loss function value corresponding to the third stage, and e(4) is the a loss function value corresponding to the fourth stage.

In an embodiment, the first stage and the second stage of the age-related macular degeneration correspond to the first group (that is, the group of the stages that do not require a referral), and the third stage and the fourth stage of the age-related macular degeneration correspond to the second group (that is, the group of the stages that require a referral). The processor 110 may receive a message through the transceiver 130, so as to obtain the age-related macular degeneration stage (for example, the first stage, the second stage, the third stage, or the fourth stage) and the group (for example: the first group or the second group).

A loss function of the machine learning algorithm is, for example, a binary cross entropy function 20. The processor 110 may generate the loss function vector 23 according to the binary cross entropy function 20. Specifically, in the process of training the classification model, a Softmax function of the machine learning algorithm may output a normalized probability vector 21. The normalized probability vector 21 may include four normalized probabilities respectively corresponding to the first stage, the second stage, the third stage, and the fourth stage. However, the disclosure is not limited thereto. For example, the normalized probability vector 21 may contain any number of normalized probabilities. In the embodiment, the normalized probability vector 21 may be expressed as [p(1) p(2) p(3) p(4)], where p(1) is a normalized probability of the first stage, p(2) is a normalized probability of the second stage, p(3) is a normalized probability of the third stage, and p(4) is a normalized probability of the fourth stage. The normalized probability belongs to a closed interval of 0 to 1, as shown in equation (1), where p(j) is a normalized probability of a j-th stage of the age-related macular degeneration.

p(j)∈[0,1]  (1)

On the other hand, the processor 110 may generate a one-hot encoding vector 22 corresponding to the age-related macular degeneration stage according to the annotation of the training data (that is, the fundus image annotated with the age-related macular degeneration stage). The one-hot encoding vector 22 may include four encoding values respectively corresponding to the first stage, the second stage, the third stage, and the fourth stage. However, the disclosure is not limited thereto. For example, the one-hot encoding vector 22 may contain any number of encoding values. In the embodiment, the one-thot encoding vector 22 may be expressed as [c(1) c(2) c(3) c(4)], where c(1) is an encoding value of the first stage, c(2) is an encoding value of the second stage, c(3) is an encoding value of the third stage, and c(4) is an encoding value of the fourth stage. The encoding value may be “0” or “1”. The one-hot encoding vector 22 may include one encoding value “1” and three encoding values “0”, where the encoding value “1” corresponds to the age-related macular degeneration stage annotated in the training data, and the encoding value “0” corresponds to the age-related macular degeneration stages not annotated in the training data. For example, when the training data is annotated as the third stage, the one-hot encoding vector 22 may be expressed as [0 0 1 0].

After obtaining the normalized probability vector 21 and one-hot encoding vector 22, the processor 110 may input the normalized probability vector 21 and the one-hot encoding vector 22 into the binary cross entropy function 20, so as to generate the loss function vector 23.

In general, two stages with a stage difference that has a smaller absolute value are more difficult to distinguish. Two stages with a stage difference that has a larger absolute value are easier to distinguish. For example, classifying the fundus image as one of the first stage and the second stage is more difficult than classifying the fundus image as one of the first stage and the third stage. In other words, a probability of the first stage being misjudged as the second stage is higher, while a probability of the first stage being misjudged as the third stage is lower. When the classification model is too focused on distinguishing the stages with a smaller stage difference, overfitting may occur. In order to prevent the overfitting of the classification model, the processor 110 may use a penalty weight to update the loss function value of the classification model, and train the classification model according to the updated loss function value. In addition, in order to prevent the classification model from misjudging the age-related macular degeneration stages belonging to the different groups, the processor 110 may update the loss function value of the classification model by using a group penalty weight, and train the classification model according to the updated loss function value.

Specifically, the processor 110 may multiply the loss function vector 23 and a weight matrix 24, so as to generate an updated loss function vector 25, and train the classification model according to the updated loss function vector 25. A size of the updated loss function vector 25 may be the same as a size of the loss function vector 23. Assuming that the loss function vector 23 is expressed as [e(1) e(2) e(3) e(4)], then the processor 110 may calculate the updated loss function vector 25 according to equation (2), where M is the weight matrix 24, and [e(1)′ e(2)′ e(3)′ e(4)′] is the updated loss function vector 25. The updated loss function vector 25 may include an updated loss function e(1)′ of the first stage, an updated loss function e(2)′ of the second stage, an updated loss function e(3)′ of the third stage, and an updated loss function e(4)′ of the fourth stage.

[e(1)′e(2)′e(3)′e(4)′]=[e(1)e(2)e(3)e(4)]·M  (2)

The updated loss function value in the updated loss function vector 25 may be expressed by equation (3), where e(i)′ represents an updated loss function value of an i-th stage (or an element of an i-th row of the updated loss function vector 25), and e(j) represents a loss function value of the j-th stage (or an element of a j-th row of the loss function vector 23), a(i,j) represents an error weight corresponding to the i-th stage and the j-th stage, b(i,j) represents a penalty weight corresponding to the i-th stage and the j-th stage, and c(i,j) represents a weight index corresponding to the i-th stage and the j-th stage. i or j belong to the closed interval of 1 to 4 (that is, i∈[1,4] and j∈[1,4]). The error weights for the different stages may be the same or different.

e(i)′=Σ_(j,j≠i) e(j)·(a(i,j)+b(i,j)+c(i,j))  (3)

As shown in the equation (3), the processor 110 may generate the updated loss function value e(1)′ according to the loss function value e(2), the loss function value e(3), or the loss function value e(4). For example, the updated loss function value e(1)′ may include a quotient e(2) b(1,2) of the loss function value e(2) and a penalty weight b(1,2), a quotient e(3) b(1,3) of the loss function value e(3) and a penalty weight b(1,3), and a quotient e(4) b(1,4) of the loss function value e(4) and a penalty weight b(1,4).

The processor 110 may calculate the penalty weight b(i, j) corresponding to the i-th stage and the j-th stage according to a stage difference between the i-th stage and the j-th stage (that is, i-j). In an embodiment, the penalty weight b(i, j) may be proportional to the absolute value of the stage difference between the i-th stage and the j-th stage, as shown in equation (4). For example, since a stage difference |1−3| between the first stage and the third stage is greater than a stage difference |1−2| between the first stage and the second stage, the penalty weight b(1,3) corresponding to the first stage and the third stage is greater than the penalty weight b(1,2) corresponding to the first stage and the second stage.

b(i,j)∝|i−j|  (4)

In an embodiment, when the i-th stage and the j-th stage belong to the same group, the weight index c(i,j) is equal to zero. When the i-th stage and the j-th stage belong to different groups, the weight index c(i,j) is equal to a group penalty weight C. In other words, when both the i-th stage and the j-th stage belong to the first group, the weight index c(i,j) is equal to zero. When both the i-th stage and the j-th stage belong to the second group, the weight index c(i,j) is equal to zero. When the i-th stage belongs to the first group and the j-th stage belongs to the second group, the weight index c(i,j) is equal to the group penalty weight C, as shown in equation (5), where S1 is the first group, and S2 is the second group.

$\begin{matrix} \left\{ \begin{matrix} {\left\{ {\left. {c\left( {i,j} \right)} \middle| i \right.,{j \in {S1{or}i}},{j \in {S2}}} \right\} = 0} \\ {\left\{ {c\left( {i,j} \right)} \middle| {i \in {S1{and}j} \in {S2}} \right\} = C} \\ {\left\{ {c\left( {i,j} \right)} \middle| {i \in {S2{and}j} \in {S1}} \right\} = C} \end{matrix} \right. & (5) \end{matrix}$

Since the first stage and the second stage belong to the first group (that is, S1), and the third stage and the fourth stage belong to the second group (that is, S2), c(1,2)=c(3,4)=0 and (1,3)=c(2,3)=C. For example, according to the equations (3) and (5), the updated loss function value e(1)′ may include the quotient e(3) C of the loss function value e(3) and the group penalty weight C, and may include the quotient e(4) C of the loss function value e(4) and the group penalty weight C. In another example, the updated loss function value e(3)′ may include the quotient e(1) C of the loss function value e(1) and the group penalty weight C, and may include the quotient e(2) C of the loss function value e(2) and the group penalty weight C.

It is assumed that each error weight a(i,j) is equal to 1, the penalty weight b(i,j) is equal to the stage difference between the i-th stage and the j-th stage multiplied by 0.1 (as shown in equation (6)), and the group penalty weight C is equal to 0.3. Accordingly, the weight matrix 24 in the equation (2) may be expressed as equation (7). The processor 110 may multiply the loss function vector 23 and the weight matrix 24, so as to generate the updated loss function vector 25. After obtaining the updated loss function vector 25, the processor 110 may train the classification model for the age-related macular degeneration according to the updated loss function vector 25.

$\begin{matrix} {{b\left( {i,j} \right)} = {0.1 \cdot {❘{i - j}❘}}} & (6) \end{matrix}$ $\begin{matrix} {M = \begin{bmatrix} 0 & {1 + {0.1}} & {1 + {0.2} + {0.3}} & {1 + {0.3} + {0.3}} \\ {1 + {0.1}} & 0 & {1 + {0.1} + {0.3}} & {1 + {0.2} + {0.3}} \\ {1 + {0.2} + {0.3}} & {1 + {0.1} + {0.3}} & 0 & {1 + {0.1}} \\ {1 + {0.3} + {0.3}} & {1 + {0.2} + {0.3}} & {1 + {0.1}} & 0 \end{bmatrix}} & (7) \end{matrix}$

FIG. 3 is a flowchart of a method of training a classification model for age-related macular degeneration according to an embodiment of the disclosure. The method may be implemented by the electronic device 100 shown in FIG. 1 . In S301, the training data is obtained. In Step S302, the loss function vector corresponding to the training data is calculated based on the machine learning algorithm. The loss function vector includes a first loss function value corresponding to a first classification of the age-related macular degeneration and a second loss function value corresponding to a second classification of the age-related macular degeneration. The first classification corresponds to the first group, and the second classification corresponds to one of the first group and the second group. In Step S303, the first loss function value is updated according to the second loss function value and the group penalty weight in response to the second classification corresponding to the second group, so as to generate the updated loss function vector. In Step S304, the classification model is trained according to the updated loss function vector.

In summary, the electronic device of the disclosure may use the classification weight to update the loss function value of the machine learning algorithm. The electronic device may use the loss function value of another classification to update the loss function value of a specific classification. When the other classification and the specific classification belong to the same group, the electronic device is not required to give the other classification a classification weight. When the other classification and the specific classification belong to different groups, the electronic device gives the other classification a classification weight. The classification model trained by the updated loss function is less likely to misjudge a stage of the age-related macular degeneration as another stage corresponding to a different group. According to the classification results of the classification model, the medical personnel do not misjudge a patient who requires a referral as a patient who does not require a referral, or misjudge a patient who does not require a referral as a patient who requires a referral.

Although the disclosure has been described with reference to the above-mentioned embodiments, it is not intended to be exhaustive or to limit the disclosure to the precise form or to exemplary embodiments disclosed. It is apparent to one of ordinary skill in the art that modifications to the described embodiments may be made without departing from the spirit and the scope of the disclosure. Accordingly, the scope of the disclosure is defined by the claims appended hereto and their equivalents in which all terms are meant in their broadest reasonable sense unless otherwise indicated. 

What is claimed is:
 1. An electronic device for training a classification model for age-related macular degeneration, comprising: a transceiver; and a processor, coupled to the transceiver, wherein the processor is configured to: obtaining training data through the transceiver; calculate a loss function vector corresponding to the training data based on a machine learning algorithm, wherein the loss function vector comprises a first loss function value corresponding to a first classification of the age-related macular degeneration and a second loss function value corresponding to a second classification of the age-related macular degeneration, the first classification corresponds to a first group, and the second classification corresponds to one of the first group and a second group; update the first loss function value according to the second loss function value and a group penalty weight in response to the second classification corresponding to the second group, so as to generate an updated loss function vector; and train the classification model according to the updated loss function vector.
 2. The electronic device according to claim 1, wherein the processor is further configured to: update the first loss function value according to the second loss function value in response to the second classification corresponding to the first group, so as to generate the updated loss function vector.
 3. The electronic device according to claim 1, wherein the first classification and the second classification respectively correspond to different stages of the age-related macular degeneration, wherein the processor is further configured to: generate a first penalty weight based on a stage difference between the first classification and the second classification; and update the first loss function value according to the second loss function value and the first penalty weight, so as to generate the updated loss function vector.
 4. The electronic device according to claim 3, wherein the loss function vector further comprises a third loss function value corresponding to a third classification of the age-related macular degeneration, wherein the processor is further configured to: generate a second penalty weight based on a second stage difference between the first classification and the third classification; and update the first loss function value according to the third loss function value and the second penalty weight, so as to generate the updated loss function vector.
 5. The electronic device according to claim 4, wherein the third classification corresponds to one of the first group and the second group, wherein the processor is further configured to: update the first loss function value according to the third loss function value and the second penalty weight in response to the third classification corresponding to the first group, so as to generate the updated loss function vector; and update the first loss function value according to the third loss function value, the second penalty weight, and the group penalty weight in response to the third classification corresponding to the second group, so as to generate the updated loss function vector.
 6. The electronic device according to claim 4, wherein the second stage difference is greater than the stage difference, and the second penalty weight is greater than the first penalty weight.
 7. The electronic device according to claim 3, wherein the first penalty weight is proportional to the stage difference.
 8. The electronic device according to claim 1, wherein the training data further comprises a fundus image annotated with an age-related macular degeneration stage, and the loss function vector corresponds to a binary cross entropy function.
 9. The electronic device according to claim 1, wherein the processor calculates a quotient of the second loss function value and the group penalty weight, so as to generate the updated loss function vector.
 10. A method of training a classification model for age-related macular degeneration, comprising: obtaining training data; calculating a loss function vector corresponding to the training data based on a machine learning algorithm, wherein the loss function vector comprises a first loss function value corresponding to a first classification of the age-related macular degeneration and a second loss function value corresponding to a second classification of the age-related macular degeneration, the first classification corresponds to a first group, and the second classification corresponds to one of the first group and a second group; updating the first loss function value according to the second loss function value and a group penalty weight in response to the second classification corresponding to the second group, so as to generate an updated loss function vector; and training the classification model according to the updated loss function vector. 